package com.atguigu.gmallpublisher1.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface ProductStatsMapper {

    //获取GMV总数
    @Select("select sum(order_amount) from product_stats_201109 where toYYYYMMDD(stt)=#{date}")
    public BigDecimal selectGmv(int date);

    //根据品牌获取GMV
    @Select("select tm_name,sum(order_amount) sum_amount from product_stats_201109 where toYYYYMMDD(stt)=#{date} group by tm_name order by sum_amount desc limit #{limit}")
    public List<Map> selectGmvByTm(@Param("date") int date, @Param("limit") int limit);

}